package store.lunangangster.nodeflow.autoconfigure;

import java.time.Duration;
import java.util.List;
import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = "nodeflow", ignoreInvalidFields = true)
public class NodeFlowProperties {

	// 项目启动即解析规则文件
	private Boolean parseOnStart;
	// 规则文件路径
	private List<String> sourcePath;
	// 默认SLOTS槽个数
	private Integer slotsSize;
	// 线程池参数
	private Pool pool;

	public Boolean getParseOnStart() {
		return parseOnStart;
	}

	public void setParseOnStart(Boolean parseOnStart) {
		this.parseOnStart = parseOnStart;
	}

	public List<String> getSourcePath() {
		return sourcePath;
	}

	public void setSourcePath(List<String> sourcePath) {
		this.sourcePath = sourcePath;
	}

	public Integer getSlotsSize() {
		return slotsSize;
	}

	public void setSlotsSize(Integer slotsSize) {
		this.slotsSize = slotsSize;
	}

	public Pool getPool() {
		return pool;
	}

	public void setPool(Pool pool) {
		this.pool = pool;
	}

	// 用于并行编排的线程池参数
	public static class Pool {
		// 最小线程数
		private Integer minActive;
		// 最大线程数
		private Integer maxActive;
		// 线程闲置时最大存活时间
		private Duration keepAliveTime;

		public Integer getMinActive() {
			return minActive;
		}

		public void setMinActive(Integer minActive) {
			this.minActive = minActive;
		}

		public Integer getMaxActive() {
			return maxActive;
		}

		public void setMaxActive(Integer maxActive) {
			this.maxActive = maxActive;
		}

		public Duration getKeepAliveTime() {
			return keepAliveTime;
		}

		public void setKeepAliveTime(Duration keepAliveTime) {
			this.keepAliveTime = keepAliveTime;
		}
	}
}
